<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>平台组件管理系统</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>

    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <link rel="stylesheet" href="./lib/content-menu/jquery.contextMenu.css">
    <script src="./lib/content-menu/jquery-1.8.2.min.js"></script>
    <script src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <script type="text/javascript" src="./js/global.js"></script>
    <script type="text/javascript" src="./js/cookies.js"></script>
    <script src="./lib/vue/vue.min.js"></script>
    <script src="./lib/vue/axios.min.js"></script>
    <script src="./lib/content-menu/jquery.contextMenu.js"></script>
    <script>

    </script>
</head>
<body>
<div id="app">
    <!-- 顶部开始 -->
    <div class="container">
        <div class="logo"><a href="./index.html">平台组件管理系统</a></div>
        <div class="left_open">
            <i title="展开左侧栏" class="iconfont">&#xe699;</i>
        </div>
        <ul class="layui-nav right" lay-filter="">
            <li class="layui-nav-item">
                <a id="system" onclick="x_admin_show('系统更新日志','./page/system-log.html',1230,620,false)">系统更新
                    <span v-show="systemLogCount > 0" class="layui-badge-dot" style="margin: -10px 0px 0;"></span>&nbsp;&nbsp;
                </a></li>
            <li class="layui-nav-item">
                <a id="notice" onclick="x_admin_show('消息通知','./page/message.html',1230,620,false,updateMsgCount)">消息
                    <span v-show="msgCount > 0" class="layui-badge" style="margin: -10px 0px 0;">{{msgCount}}</span>&nbsp;&nbsp;
                </a></li>
            <li class="layui-nav-item">
                <a href="javascript:;">{{ username }}</a>
                <dl class="layui-nav-child"> <!-- 二级菜单 -->
                    <dd><a onclick="x_admin_show('个人信息','./page/user-info.html')">个人信息</a></dd>
                    <dd><a onclick="x_admin_show('修改密码','./page/password.html',600,400)">修改密码</a></dd>
                    <hr>
                    <dd><a @click="logout">退出</a></dd>
                </dl>
            </li>
        </ul>
    </div>
    <!-- 顶部结束 -->
    <!-- 中部开始 -->
    <!-- 左侧菜单开始 -->
    <div class="left-nav">
        <div id="side-nav">
            <ul id="nav">
                <li>
                    <a href="javascript:;">
                        <i class="iconfont">&#xe6b4;</i>
                        <cite>基本信息管理</cite>
                        <i class="iconfont nav_right">&#xe697;</i>
                    </a>
                    <ul class="sub-menu">
                        <li>
                            <a _href="./page/developer-list.html">
                                <i class="iconfont">&#xe839;</i>
                                <cite>开发人员信息管理</cite>
                            </a>
                        </li>
                        <li>
                            <a _href="./page/manager-list.html">
                                <i class="iconfont ">
                                    &#xe839;
                                </i>
                                <cite>管理人员信息管理</cite>
                            </a>
                        </li>
                        <li>
                            <a _href="./page/component-list.html">
                                <i class="iconfont">&#xe70c;</i>
                                <cite>平台组件信息管理</cite>
                            </a>
                        </li>
                        <li>
                            <a _href="./page/environment-list.html">
                                <i class="iconfont">&#xe705;</i>
                                <cite>组件环境管理</cite>
                            </a>
                        </li>
                        <!-- <li>
                             <a _href="./page/company-list.html">
                                 <i class="iconfont">&#xe6f7;</i>
                                 <cite>公司信息管理</cite>
                             </a>
                         </li>-->
                    </ul>
                </li>
                <li>
                    <a _href="./page/component-usage-list.html">
                        <i class="iconfont">&#xe839;</i>
                        <cite>组件使用信息管理</cite>
                    </a>
                </li>
                <li>
                    <a _href="./page/requestion-list.html">
                        <i class="iconfont">&#xe839;</i>
                        <cite>申请流程管理</cite>
                    </a>
                </li>

                <li>
                    <a href="http://158.222.59.22:8081/?target=/md/index" target="_blank">
                        <i class="iconfont">&#xe6a3;</i>
                        <cite>帮助文档</cite>
                    </a>
                </li>
            </ul>
        </div>
    </div>
    <!-- <div class="x-slide_left"></div> -->
    <!-- 左侧菜单结束 -->
    <!-- 右侧主体开始 -->
    <div class="page-content">
        <div class="layui-tab tab" lay-filter="xbs_tab" lay-allowclose="false">
            <ul class="layui-tab-title">
                <li class="home  context-menu-one"><i class="layui-icon">&#xe68e;</i>欢迎使用</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <iframe src='./page/welcome.html' frameborder="0" scrolling="yes" class="x-iframe"></iframe>
                </div>
            </div>
        </div>
    </div>
    <div class="page-content-bg"></div>
    <!-- 右侧主体结束 -->
    <!-- 中部结束 -->
    <!-- 底部开始 -->
    <div class="footer">
        <div class="copyright">Copyright ©2018 dap@pactera.com v1.0 All Rights Reserved</div>
    </div>
    <!-- 底部结束 -->
</div>
<script>
    $(function () {
        layui.use(['element'],
            function () {
                var element = layui.element
                $.contextMenu({
                    selector: '.context-menu-one',
                    callback: function (key, options) {
                        let tabArray = $(this.context.parentElement).children('li')
                        let tabLength = tabArray.length
                        let itemIndex = $(this).index()
                        let itemId = $(this.context).attr('lay-id')
                        if (key === "closeAll") {
                            //全部关闭
                            for (let i = 1; i < tabLength; i++) {
                                element.tabDelete("xbs_tab", $(tabArray[i]).attr('lay-id'))
                            }
                        }
                        else if (key === "closeOthers") {
                            //关闭其他
                            for (let i = 1; i < tabLength; i++) {
                                let otherId = $(tabArray[i]).attr('lay-id')
                                if (otherId != itemId) {
                                    element.tabDelete("xbs_tab", otherId)
                                }
                            }
                        }
                        else if (key === "closeRight") {
                            //关闭右边
                            for (let i = itemIndex + 1; i < tabLength; i++) {
                                element.tabDelete("xbs_tab", $(tabArray[i]).attr('lay-id'))
                            }
                        }
                    },
                    items: {
                        "closeAll": {name: "关闭所有", icon: 'all'},
                        "sep1": "---------",
                        "closeRight": {name: "关闭右侧", icon: 'right'},
                        "sep2": "---------",
                        "closeOthers": {name: "关闭其他", icon: 'others'}
                    }
                });
            })

    });
   function updateMsgCount () {
    $.get(_hostUrl + "/msgs").then(response => {
            if (response.responseCode === 200) {
                if(response.data){
                    vm.msgCount = response.data.totalRecord
                }else{
                    vm.msgCount = 0
                }
            }
        })
    }
</script>
<script>
    let vm = new Vue({
        el: '#app',
        data() {
            return {
                username: '',
                superFlag: 0,
                projectInfo: [],
                msgCount: 0,
                systemLogCount: 0
            }
        },
        beforeCreate() {
        },
        //渲染之前加载cookie数据
        beforeMount() {
            checkLogin()
            this.username = getCookie('username')
            this.superFlag = getCookie('userType')
            axios.get(_hostUrl + "/msgs").then(response => {
                if (response.data.responseCode === 200) {
                    if(response.data.data){
                        this.msgCount = response.data.data.totalRecord
                    }
                }
            })
        },
        methods: {
            logout() {
                axios.get(_hostUrl + '/logout').then(response => {
                    if (response.data.responseCode == 200) {
                        clearCookies()
                        layer.msg('退出成功', {icon: 1, time: 1000}, function () {
                            location.href = '../login.html'
                        });
                    }
                })
            }
        }
    });
</script>
</body>
</html>